package light.head.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;


import light.head.constant.Sys;
import light.head.framework.entity.ExcelField;

/**
 * 通讯录
 *
 */
@Entity
@Table
public class Communication implements Serializable {
	
	private static final long serialVersionUID = 5085467776517509366L;
	//导出的头格式:0.性别 1.姓名 2.电话 3.邮箱 4.公司 5.地址, 6.类型
	
	private Integer code;
	
	
	private Boolean sex;					// 性别 true:男 false:女
	@ExcelField(order = 2, name = "姓名")
	private String name;					// 姓名
	@ExcelField(order = 3, name = "电话")
	private String phone;					// 电话
	@ExcelField(order = 4, name = "邮箱")
	private String email;					// 电子邮件
	@ExcelField(order = 5, name = "公司")
	private String company;					// 公司名称
	@ExcelField(order = 6, name = "地址")
	private String address;					// 地址
	private Byte type;						// 类型（1.个人2.公共3.公司）
	
	private Date birthday;					// 生日
	private String remark;					// 备注
	private Integer photo;					// 照片
	private Date ct;						// 创建时间
	private Integer cu;						// 创建人
	private Boolean deleted;				// 是否删除
	private Integer oc;						// 所属机构
	
	@ExcelField(order = 1, name = "性别")
	private String strSex;
	@ExcelField(order = 7, name = "类型")
	private String strType;
	
	
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column
	public Integer getCode() {
		return code;
	}
	@Column(length = 20)
	public String getName() {
		return name;
	}
	@Column
	public String getPhone() {
		return phone;
	}
	@Column(length = 4)
	public Boolean getSex() {
		return sex;
	}
	@Column(length = 50)
	public String getEmail() {
		return email;
	}
	@Column
	public Date getBirthday() {
		return birthday;
	}
	@Column(length = 500)
	public String getRemark() {
		return remark;
	}
	@Column
	public Integer getPhoto() {
		return photo;
	}
	@Column
	public Integer getCu() {
		return cu;
	}
	@Column
	public Boolean getDeleted() {
		return deleted;
	}
	@Column
	public Date getCt() {
		return ct;
	}
	@Column
	public Byte getType() {
		return type;
	}
	@Column
	public String getCompany() {
		return company;
	}
	@Column
	public String getAddress() {
		return address;
	}
	@Column
	public Integer getOc() {
		return oc;
	}
	
	@Transient
	public String getStrSex() {
		return strSex;
	}
	

	@Transient
	public String getStrType() {
		return strType;
	}
	
	
	
	public void setStrType(String strType) {
		this.strType = strType;
	}
	public void setStrSex(String strSex) {
		this.strSex = strSex;
	}
	public void setOc(Integer oc) {
		this.oc = oc;
	}
	public void setCt(Date ct) {
		this.ct = ct;
	}
	public void setType(Byte type) {
		if (null != type && type == Sys.B_TWO)
			this.setStrType("公共");
		else if (null != type && type == Sys.B_THREE)
			this.setStrType("公司");
		else if (null != type && type == Sys.B_ONE)
			this.setStrType("个人");
		
		this.type = type;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public void setAddress(String address) {
		this.address = address;
	}
	public void setDeleted(Boolean deleted) {
		this.deleted = deleted;
	}
	public void setCode(Integer code) {
		this.code = code;
	}
	public void setName(String name) {
		this.name = name;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
	public void setSex(Boolean sex) {
		if (null != sex && sex)
			this.setStrSex("男");
		else
			this.setStrSex("女");
		this.sex = sex;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public void setPhoto(Integer photo) {
		this.photo = photo;
	}
	public void setCu(Integer cu) {
		this.cu = cu;
	}
	
	
	
}
